package com.task.manager.mapper;

import com.task.manager.domain.SysConfig;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface SysConfigMapper {
	@Delete({ "delete from t_sys_config", "where ID = #{id,jdbcType=INTEGER}" })
	int deleteByPrimaryKey(Integer id);

	@Insert({ "insert into t_sys_config (ID, MOUDLE_CODE, ", "SYS_KEY, SYS_VALUE, ", "CREATE_TIME)", "values (#{id,jdbcType=INTEGER}, #{moudleCode,jdbcType=VARCHAR}, ",
			"#{sysKey,jdbcType=VARCHAR}, #{sysValue,jdbcType=VARCHAR}, ", "#{createTime,jdbcType=TIMESTAMP})" })
	int insert(SysConfig record);

	@InsertProvider(type = SysConfigSqlProvider.class, method = "insertSelective")
	int insertSelective(SysConfig record);

	@Select({ "select", "ID, MOUDLE_CODE, SYS_KEY, SYS_VALUE, CREATE_TIME", "from t_sys_config", "where ID = #{id,jdbcType=INTEGER}" })
	@Results({ @Result(column = "ID", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "MOUDLE_CODE", property = "moudleCode", jdbcType = JdbcType.VARCHAR),
			@Result(column = "SYS_KEY", property = "sysKey", jdbcType = JdbcType.VARCHAR), @Result(column = "SYS_VALUE", property = "sysValue", jdbcType = JdbcType.VARCHAR),
			@Result(column = "CREATE_TIME", property = "createTime", jdbcType = JdbcType.TIMESTAMP) })
	SysConfig selectByPrimaryKey(Integer id);

	@UpdateProvider(type = SysConfigSqlProvider.class, method = "updateByPrimaryKeySelective")
	int updateByPrimaryKeySelective(SysConfig record);

	@Update({ "update t_sys_config", "set MOUDLE_CODE = #{moudleCode,jdbcType=VARCHAR},", "SYS_KEY = #{sysKey,jdbcType=VARCHAR},", "SYS_VALUE = #{sysValue,jdbcType=VARCHAR},",
			"CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}", "where ID = #{id,jdbcType=INTEGER}" })
	int updateByPrimaryKey(SysConfig record);
}